-
Notifications
You must be signed in to change notification settings - Fork 278
[GeoMechanicsApplication] Move all non-template code to .cpp files and make sure any .h file does not contain any implementations (processes) #14075
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
rfaasse
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the efforts of splitting classes into header + source, improving the 'include health' in a lot of these classes and also making the changes in a way that makes diffing as easy as possible (i.e. you kept the same order in the functions, that's much appreciated 😄 ).
I didn't do an in-depth review of all code, but mainly checked it stayed the same and all implementations were moved out of the headers. I only have a few minor comments about forward declares, includes and some left-over implementations in .h files.
...oMechanicsApplication/custom_processes/apply_boundary_phreatic_line_pressure_table_process.h
Outdated
Show resolved
Hide resolved
| { | ||
|
|
||
| class Model; | ||
| class Parameters; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here the forward declare does work, because the Parameters are passed as reference 👍
applications/GeoMechanicsApplication/custom_processes/apply_component_table_process.h
Outdated
Show resolved
Hide resolved
| /// output stream function | ||
| inline std::ostream& operator<<(std::ostream& rOStream, const ApplyConstantInterpolateLinePressureProcess& rThis) | ||
| { | ||
| rThis.PrintInfo(rOStream); | ||
| rOStream << std::endl; | ||
| rThis.PrintData(rOStream); | ||
|
|
||
| return rOStream; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this also be moved to the cpp?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is possible but then it could not be inline, right? As far as I remember a compiler makes a decision and it can ignore inline statements.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed these operators. Once Anne asked to remove such lines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's also a solution, fine with me!
...echanicsApplication/custom_processes/apply_constant_phreatic_multi_line_pressure_process.cpp
Show resolved
Hide resolved
applications/GeoMechanicsApplication/custom_processes/apply_normal_load_table_process.h
Show resolved
Hide resolved
applications/GeoMechanicsApplication/custom_processes/apply_write_result_scalar_process.h
Outdated
Show resolved
Hide resolved
.../GeoMechanicsApplication/custom_processes/apply_phreatic_multi_line_pressure_table_process.h
Outdated
Show resolved
Hide resolved
...eoMechanicsApplication/custom_processes/deactivate_conditions_on_inactive_elements_process.h
Outdated
Show resolved
Hide resolved
…-cpp-processes # Conflicts: # applications/GeoMechanicsApplication/custom_workflows/dgeoflow.h # applications/GeoMechanicsApplication/custom_workflows/dgeosettlement.cpp
rfaasse
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for processing the review comments. I only have a single suggestion, that you should ignore, unless there are some other changes you'd also like to do. Ready to go from my side!
| /// Execute method is used to execute the ApplyWriteScalarProcess algorithms. | ||
| void Execute() override; | ||
| void Execute() override { | ||
| // to avoid using the base class function | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Execute method of the base is also just an empty function, so I don't think we need to override it, we could just remove the function. It's not enough to block the PR for though, so please only do it if there's something else you'd like to change as well.
| for (unsigned int j = 0; j < BoundaryNodes.size(); ++j) { | ||
| if (Id == BoundaryNodes[j]) { | ||
| mBoundaryNodes[iPosition++] = &rNode; | ||
| const auto Id = static_cast<int>(rNode.Id()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now, I think the static casts are fine. However, I think in the longer term, it would be a good idea to just make sure everything in this class is in terms of std::size_t, since the Id() functions return this. But that's out of scope of this PR and probably also needs to be discussed with others, so let's leave it for now (same for the other casts in this file)
| ElementIDs[iPoint][i] = iElementID; | ||
| } | ||
| } | ||
| constexpr int ID_UNDEFINED = -1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of scope for this PR (and of course it was already there), but working like this with 'undefined ids' should really be avoided. We can refactor this later (first adding unit tests, then making changes)
| << "No boundary node is found for interpolate line pressure process" << std::endl; | ||
| } | ||
|
|
||
| bool ApplyConstantInterpolateLinePressureProcess::IsMoreThanOneElementWithThisEdgeFast( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for refactoring this function slightly, such that the complexity is lower. I think it can be simplified even more, but that's out of scope of this PR. For that I'd like to first add unit tests and then start simplifying (and seeing how small +clear we could get this code).
That's for later, thanks for the efforts here!
| /// output stream function | ||
| inline std::ostream& operator<<(std::ostream& rOStream, const ApplyConstantInterpolateLinePressureProcess& rThis) | ||
| { | ||
| rThis.PrintInfo(rOStream); | ||
| rOStream << std::endl; | ||
| rThis.PrintData(rOStream); | ||
|
|
||
| return rOStream; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's also a solution, fine with me!
|
Hi Richard, many thanks for the review and comments. They are in Kratos Product Backlog (view) for future work. |
📝 Description
A brief description of the PR.